import java.util.Random;

/**
 * @author: gao
 * @create-date: 2025/3/8 13:02
 */

public class Sort {
    public void SelectSort(int[] array){
        for (int i = 0; i < array.length; i++) {
            int MinIndex = i;
            for (int j = i+1; j < array.length; j++) {
                if(array[MinIndex] > array[j]){
                    MinIndex = j;
                }
            }
            swap(array,MinIndex,i);
        }
    }

    private void swap(int[] array,int i,int j){
        int tmp = array[i];
        array[i] = array[j];
        array[j] = tmp;
    }

    public void DisOrder(int[] array) {
        Random ran = new Random();
        for (int i = 0; i < array.length; i++) {
            array[i] = ran.nextInt(100);
        }
    }
}